<form method="post" action="<?php _actionUrl($this)?>" onsubmit="return ajax_form(this)">
<div class="x-list-title">
<table width="100%" border="0" height="100%">
<tr>
	<td align="left">
		<h2>Người dùng mới</h2>
	</td>
	<td align="right"></td>
</tr>
</table>	
</div>
<div class="x-form-container">
<table width="100%" border="0" cellpadding="5" class="x-form">	
	<tr class="row-message">
		<td colspan="2">
			<div class="form-message"></div>
		</td>
	</tr>
	<tr>
		<td width="180" class="x-form-label">
			Tên tài khoản: 
		</td>
		<td class="x-form-input">
			<input name="username" type="text" style="width:200px" class="x-text" value="<?php echo $post['username'];?>"/>
		</td>
	</tr>
	<tr>	
		<td class="x-form-label">
			Mật khẩu: 
		</td>
		<td class="x-form-input">
			<input name="password" type="password" style="width:200px" class="x-text" value="<?php echo $post['password']?>" />
		</td>
	</tr>
	<tr>	
		<td class="x-form-label">
			Xác nhận lại:  
		</td>
		<td class="x-form-input">
			<input type="password" name="re_password" style="width:200px" class="x-text" value="<?php _e($post['title']);?>"/>
		</td>
	</tr>
	<tr>	
		<td class="x-form-label">
			Email: 
		</td>
		<td class="x-form-input">
			<input type="text" name="email" class="x-text" value="" style="width:300px"/>
		</td>
	</tr>
	<tr>	
		<td class="x-form-label">
			Họ tên: 
		</td>
		<td class="x-form-input">
			<input type="text" name="fullname" class="x-text" value="" style="width:300px"/>
		</td>
	</tr>
	<tr>	
		<td class="x-form-label">
			Di động: 
		</td>
		<td class="x-form-input">
			<input type="text" name="phone" class="x-text" value="" style="width:300px"/>
		</td>
	</tr>
	<tr>	
		<td  class="x-form-label">
			Hồ sơ nhân sự: 
		</td>
		<td>
			<select name="personnel_id" class="x-select" style="width:150px">
				<option value="0">Không chọn</option>
				<?php	foreach($this->get('personnels') as $k => $v ):?>
					<option value="<?php _e($v['ID']);?>"><?php _e($v['name']);?></option>
				<?php endforeach;?>
		</select>
		</td>
	</tr>
	<tr>	
		<td class="x-form-label">
			Nhóm người dùng:
		</td>
		<td>
		<select name="group_id" class="x-select" style="width:200px">
			<option value="0">Chọn nhóm người dùng</option>
			<?php	foreach($this->get('groups') as $k => $v ):?>
				<option value="<?php _e($v['ID']);?>"><?php _e($v['title']);?></option>
			<?php endforeach;?>
		</select>
		</td>
	</tr>
	<tr>	
		<td class="x-form-label">
			Phòng ban:
		</td>
		<td>
		<select name="department_id" class="x-select" style="width:200px">
		<?php _e( select_options($this->get('departments')) );?>	
		</select>
		</td>
	</tr>
	<tr>	
		<td class="x-form-label">
			Phân quyền:
		</td>
		<td>
			<div>
			<div style="padding:10px 0px;color:red">
			<input type="hidden" name="inherit_roles" value="yes" />
			<label for="inherit_roles">
				<input type="checkbox" name="inherit_roles" onclick="$(this.parentNode.parentNode.parentNode).find('table input[type=checkbox]').set('disabled',!this.checked)" value="no" /> Tùy chỉnh lại quyền </label>
			</div>
			<table style="background:#fff" border="1" bordercolor="#cccccc" cellpadding="0">
				<tr>
					<td valign="top" height="100">
						<table width="200" cellpadding="5">
							<tr class="role-section">
								<td align="center" width="10">
									<input type="checkbox" onclick="$(this).parent('table').slice(0,1).find('input[name*=roles]').set('checked',this.checked)" disabled/>
								</td>
								<td>Hệ thống</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="login" checked disabled/></td>
								<td>Truy cập</td>
							</tr>						
							<tr>
								<td><input type="checkbox" name="roles[]" value="email" checked disabled/></td>
								<td>Email</td>
							</tr>						
							<tr>
								<td><input type="checkbox" name="roles[]" value="message" checked disabled/></td>
								<td>Tin nhắn</td>
							</tr>						
							<tr>
								<td><input type="checkbox" name="roles[]" value="yahoo" checked disabled/></td>
								<td>Chát</td>
							</tr>												
							<tr>
								<td><input type="checkbox" name="roles[]" value="manage_admin" disabled/></td>
								<td>Quản trị hệ thống</td>
							</tr>						
							<tr>
								<td><input type="checkbox" name="roles[]" value="manage_news" disabled/></td>
								<td>Quản trị tin tức</td>
							</tr>						
							<tr>
								<td><input type="checkbox" name="roles[]" value="manage_forum" disabled/></td>
								<td>Quản trị diễn đàn</td>
							</tr>						
						</table>					
					</td>
					<td valign="top">
						<table width="200" cellpadding="5">
							<tr class="role-section">
								<td align="center" width="10">
									<input type="checkbox" onclick="$(this).parent('table').slice(0,1).find('input[name*=roles]').set('checked',this.checked)" disabled/>
								</td>
								<td>Dự án / công việc</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="task" checked disabled/></td>
								<td>Truy cập</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="add_project" disabled/></td>
								<td>Tạo dự án</td>
							</tr>						
							<tr>
								<td><input type="checkbox" name="roles[]" value="add_task" disabled/></td>
								<td>Tạo công việc</td>
							</tr>						
						</table>						
					</td>
					<td valign="top">
						<table width="200" cellpadding="5">
							<tr class="role-section">
								<td align="center" width="10">
									<input type="checkbox" onclick="$(this).parent('table').slice(0,1).find('input[name*=roles]').set('checked',this.checked)" disabled/>
								</td>
								<td>Công văn</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="diploma" checked disabled/></td>
								<td>Truy cập</td>
							</tr>							
							<tr>
								<td><input type="checkbox" name="roles[]" value="add_diploma" disabled/></td>
								<td>Tạo công văn</td>
							</tr>						
						</table>					
					</td>
					<td valign="top">
						<table width="200" cellpadding="5">
							<tr class="role-section">
								<td align="center" width="10">
									<input type="checkbox" onclick="$(this).parent('table').slice(0,1).find('input[name*=roles]').set('checked',this.checked)" disabled/>
								</td>
								<td>Tài liệu</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="document" checked disabled/></td>
								<td>Truy cập</td>
							</tr>							
							<tr>
								<td><input type="checkbox" name="roles[]" value="add_document" disabled/></td>
								<td>Tạo tài liệu</td>
							</tr>				
						</table>								
					</td>
				</tr>
				<tr>
					<td valign="top">
						<table width="200" cellpadding="5">
							<tr class="role-section">
								<td align="center" width="10">
									<input type="checkbox" onclick="$(this).parent('table').slice(0,1).find('input[name*=roles]').set('checked',this.checked)" disabled/>
								</td>
								<td>Nhân sự</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="personnel" disabled/></td>
								<td>Truy cập</td>
							</tr>
			
						</table>						
					</td>
					<td valign="top">
						<table width="200" cellpadding="5">
							<tr class="role-section">
								<td align="center" width="10">
									<input type="checkbox" onclick="$(this).parent('table').slice(0,1).find('input[name*=roles]').set('checked',this.checked)" disabled/>
								</td>
								<td>Lịch biểu</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="calendar" checked disabled/></td>
								<td>Truy cập</td>
							</tr>	
							<tr>
								<td><input type="checkbox" name="roles[]" value="add_private_calendar" checked disabled/></td>
								<td>Thêm lịch cá nhân</td>
							</tr>	
							<tr>
								<td><input type="checkbox" name="roles[]" value="add_company_calendar" checked disabled/></td>
								<td>Thêm lịch cơ quan</td>
							</tr>								
						</table>						
					</td>
					<td valign="top">
						<table width="200" cellpadding="5">
							<tr class="role-section">
								<td align="center" width="10">
									<input type="checkbox" onclick="$(this).parent('table').slice(0,1).find('input[name*=roles]').set('checked',this.checked)" disabled/>
								</td>
								<td>CRM</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="crm" checked disabled/></td>
								<td>Truy cập</td>
							</tr>	
							<tr>
								<td><input type="checkbox" name="roles[]" value="crm_admin" disabled/></td>
								<td>Quản lý</td>
							</tr>	
						</table>	
					</td>
					<td valign="top">
						<table width="200" cellpadding="5">
							<tr class="role-section">
								<td align="center" width="10">
									<input type="checkbox" onclick="$(this).parent('table').slice(0,1).find('input[name*=roles]').set('checked',this.checked)" disabled/>
								</td>
								<td>Tài sản</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="asset" checked disabled/></td>
								<td>Truy cập</td>
							</tr>	
							<tr>
								<td><input type="checkbox" name="roles[]" value="manage_asset" disabled/></td>
								<td>Quản lý</td>
							</tr>	
						</table>			
					</td>
				</tr>	
			<tr>
					<td valign="top">
						<table width="200" cellpadding="5">
							<tr class="role-section">
								<td align="center" width="10">
									<input type="checkbox" onclick="$(this).parent('table').slice(0,1).find('input[name*=roles]').set('checked',this.checked)" disabled/>
								</td>
								<td>Danh bạ</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="contact_company" disabled/></td>
								<td>Xem danh bạ cơ quan</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="contact_share" disabled/></td>
								<td>Xem danh bạ chia sẻ</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="contact_person" disabled/></td>
								<td>Quản lý danh bạ cá nhân</td>
							</tr>
							<tr>
								<td><input type="checkbox" name="roles[]" value="contact_company_manage" disabled/></td>
								<td>Quản lý danh bạ cơ quan</td>
							</tr>
						</table>						
					</td>
					<td valign="top">
					</td>
					<td valign="top">
					</td>
					<td valign="top">
					</td>
				</tr>				
			</table></div>
			</td>
	</tr>
	<tr>	
		<td class="x-form-label"></td>
		<td>
			<input type="submit" value="Xác nhận" class="x-button x-save" />
			<input type="reset"  value="Làm mới" class="x-button x-fresh" />
		</td>
	</tr>
</table>
</div>
</form>